

package com.controller;

import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.service.UserService;
import javax.servlet.RequestDispatcher;
import com.model.Guess;
import java.util.List;


public class ViewAllGuessController extends HttpServlet {
   
 
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

        
        try {

            UserService userService = new UserService();

            userService.setConnection();

             List<Guess> list = userService.getAllGuess();

             userService.closeConnection();

             request.setAttribute("AllGuessList", list);
             RequestDispatcher  requestDispatcher = request.getRequestDispatcher("/viewAllGuess.jsp");
             requestDispatcher.forward(request, response);




        } catch (ClassNotFoundException ex) {
          ex.printStackTrace();
        } catch (SQLException ex) {
           ex.printStackTrace();
        }

     


    } 

  
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

    }
}
